package com.xq.spring.container;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

import com.xq.spring.beans.Chinese;

/**
 * 基础容器BeanFactory.
 * 
 * @author 郭凯强
 */
public class BaseBeanFactory {
	public static void main(String[] args) {
		Resource resource = new ClassPathResource("beans.xml");
		// 创建默认的BeanFactory
		DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
		// 让默认的BeanFactory容器加载resource对应的XML配置文件
		new XmlBeanDefinitionReader(beanFactory).loadBeanDefinitions(resource);
		//=============
		Chinese chinese = beanFactory.getBean(Chinese.class);
		chinese.useAxe();
	}
}
